package io;

import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("./fos.txt",true);//append追加
        Scanner sc = new Scanner(System.in);
        while (true){
            String line = sc.nextLine();
            if("exit".equals(line)){
                break;
            }
            byte[] data = line.getBytes(StandardCharsets.UTF_8);
            fos.write(data);
        }
        fos.close();
    }
}
